import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'leaflet/dist/leaflet.css'
import L from 'leaflet'
import eIconPicker from 'e-icon-picker';
import "e-icon-picker/lib/symbol.js"; //基本彩色图标库
import 'e-icon-picker/lib/index.css'; // 基本样式，包含基本图标
import 'font-awesome/css/font-awesome.min.css'; //font-awesome 图标库
import 'element-ui/lib/theme-chalk/icon.css'; //element-ui 图标库
import QRCode from "qrcode"; //引入生成二维码插件

axios.interceptors.request.use((config) => {
  config.headers.token = window.sessionStorage.getItem('token')
  return config
})

axios.interceptors.response.use((config) => {
  if (config.data.code === '401') {
    ElementUI.Message(config.data.obj)
    router.push('/')
  }
  return config
})

Vue.prototype.$L = L

Vue.use(ElementUI)
Vue.config.productionTip = false

Vue.prototype.$axios = axios

Vue.prototype.$QRCode = QRCode

Vue.use(eIconPicker, {
  FontAwesome: true,
  ElementUI: true,
  eIcon: true,//自带的图标，来自阿里妈妈
  eIconSymbol: true,//是否开启彩色图标
  addIconList: [],
  removeIconList: [],
  zIndex: 3100//选择器弹层的最低层,全局配置
});

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
